<template>
    <view style="height: 100%">
        <ul class="db">
            <block v-for="(item, index) in list" :key="index">
                <li class="db bgcf br12 pd015 mb10">
                    <navigator class="db" :url="'/pages/myOrder/returnDetail?id=' + item.id" hover-class="none" open-type="navigate">
                        <view class="df ac sb h44 bbf1">
                            <p class="f12 c9d">订单号：{{ item.order_sn }}</p>
                            <view>
                                <p class="f12 cff8" v-if="item.is_refund == 1">退款审核中</p>
                                <p class="f12 c3a" v-if="item.is_refund == 2">退款成功</p>
                                <p class="f12 cf5" v-if="item.is_refund == 3">退款已驳回</p>
                            </view>
                        </view>
                        <view class="pd150 bbf1 df">
                            <image class="img72 br8 mr12"  referrerPolicy='no-referrer' :src="item.thumb" />
                            <view class="f1">
                                <h2 class="db w224 ovh f14 c28 f500">{{ item.title }}</h2>
                                <P class="f12 c9d db mt8">{{ item.sku_title }}</P>
                                <view class="df ac sb mt12">
                                    <p class="f12 f500 c28">¥{{ item.price }}</p>
                                    <p class="f12 c9d">×{{ item.number }}</p>
                                </view>
                            </view>
                        </view>

                        <view class="pd150">
                            <view class="df ac sb">
                                <P class="f12 c9d">{{ item.order_refund_at }}</P>
                                <view class="df ac c28 f12">
                                    <span>总价:</span>
                                    <span class="f600">¥{{ item.need_price }}</span>
                                </view>
                            </view>
                        </view>
                    </navigator>
                </li>
            </block>
        </ul>
    </view>
</template>

<script>
const http = require('../../utils/http');
export default {
    data() {
        return {
            list: [],
            page: 1,
            pagesize: 10,
            pageTotal: ''
        };
    }
    /**
     * 生命周期函数--监听页面加载
     */,
    onLoad(options) {
        this.getList();
    },
    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady() {},
    /**
     * 生命周期函数--监听页面显示
     */
    onShow(options) {},
    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide() {},
    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload() {},
    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh() {},
    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom() {
        if (this.pageTotal > this.page) {
            this.setData({
                page: this.page + 1
            });
            this.getList();
        } else {
            uni.showToast({
                title: '没有更多了~',
                icon: 'none'
            });
        }
    },
    /**
     * 用户点击右上角分享
     */
    onShareAppMessage() {},
    methods: {
        getList() {
            let data = {
                page: this.page,
                pagesize: this.pagesize
            };
            http.request('order/refundOrderList', data)
                .then((res) => {
                    res.data.list.forEach((i) => {
                        this.list.push(i);
                    });
                    this.setData({
                        list: this.list,
                        pageTotal: res.data.pageTotal
                    });
                })
                .catch((res) => {
                    uni.showToast({
                        title: res.message,
                        icon: 'none'
                    });
                });
        }
    }
};
</script>
<style>
@import './returnList.css';
</style>
